package name.mrzc.licensing.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import name.mrzc.licensing.db.ILicenseDB;
import name.mrzc.licensing.dbutils.LicenseDbutils;
import name.mrzc.licensing.mapper.LicenseMapper;
import name.mrzc.licensing.model.License;
import name.mrzc.licensing.repository.LicenseRepository;
import name.mrzc.licensing.template.LicenseTemplate;

@Service
public class LicenseService {

	@Autowired
	private LicenseMapper licenseMapper = null;

	@Autowired
	private LicenseRepository licenseRepository = null;

	@Autowired
	private LicenseTemplate licenseTemplate = null;

	@Autowired
	private LicenseDbutils licenseDbutils = null;
	
	@Autowired
	@Qualifier("licenseMapper")
	private ILicenseDB licenseDB;

	public void saveLicense(License license) {

	}

	public List<License> getLicensesByOrg(String organizationId) {
		List<License> list = licenseMapper.findByOrganizationId(organizationId);
		list.addAll(licenseRepository.findByOrganizationId(organizationId));
		list.addAll(licenseTemplate.findByOrganizationId(organizationId));
		list.addAll(licenseDbutils.findByOrganizationId(organizationId));
		System.out.println(licenseDB.getClass()+ " " + licenseMapper.getClass());
		return list;
	}

}
